package com.google.android.material.behavior;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewPropertyAnimator;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior;
import o.aqv;

public class HideBottomViewOnScrollBehavior<V extends View> extends Behavior<V> {
    private int ˊ = 2;
    private ViewPropertyAnimator ˋ;
    private int ॱ = 0;

    public HideBottomViewOnScrollBehavior(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public boolean ˎ(CoordinatorLayout coordinatorLayout, V v, int i) {
        this.ॱ = v.getMeasuredHeight();
        return super.ˎ(coordinatorLayout, (View) v, i);
    }

    public boolean ˏ(CoordinatorLayout coordinatorLayout, V v, View view, View view2, int i) {
        return i == 2;
    }

    public void ˎ(CoordinatorLayout coordinatorLayout, V v, View view, int i, int i2, int i3, int i4) {
        if (this.ˊ != 1 && i2 > 0) {
            ˊ(v);
        } else if (this.ˊ != 2 && i2 < 0) {
            ˋ(v);
        }
    }

    protected void ˋ(V v) {
        if (this.ˋ != null) {
            this.ˋ.cancel();
            v.clearAnimation();
        }
        this.ˊ = 2;
        ˊ(v, 0, 225, aqv.ˎ);
    }

    protected void ˊ(V v) {
        if (this.ˋ != null) {
            this.ˋ.cancel();
            v.clearAnimation();
        }
        this.ˊ = 1;
        ˊ(v, this.ॱ, 175, aqv.ˏ);
    }

    private void ˊ(V v, int i, long j, TimeInterpolator timeInterpolator) {
        this.ˋ = v.animate().translationY((float) i).setInterpolator(timeInterpolator).setDuration(j).setListener(new AnimatorListenerAdapter(this) {
            final /* synthetic */ HideBottomViewOnScrollBehavior ˋ;

            {
                this.ˋ = r1;
            }

            public void onAnimationEnd(Animator animator) {
                this.ˋ.ˋ = null;
            }
        });
    }
}
